#ifndef _DKGL_LOG_H_
#define _DKGL_LOG_H_

#define g_Log		Log::GetSingleton()
#define g_LogPtr	Log::GetSingletonPtr()

#include "dkglPreRequest.h"
#include "dkglSingleton.h"
#include <string>

namespace DKGL
{

class Log : public Singleton<Log>
{
public:
	Log()
	{
		mFileName.assign("dkglLog.txt");
		mBeEnable = true;
	};

	~Log(){};

	inline void enable_dump(bool b = true)
	{
		mBeEnable = b;
	};

	static void dump(const std::string& reason);

	/**
		dump the error message to the file.
			src_fname : file name of source code. (i.e.) example.c
			src_line : which line
	*/
	static void dump(const std::string& reason, const std::string& src_fname, int src_line, ERROR_LEVEL level = ERR_ERROR);

	/**
		Clear the current dump content.
	*/
	static void clear();// const;

	inline void setFileName(const std::string& fname)
	{mFileName.assign(fname);};
private:
	static std::string mFileName;
	std::string mErrMsg;
	bool mBeEnable;
};

}

#endif